package ln.fxspringarchetype.mapper;

import ln.fxspringarchetype.model.Course;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CourseMapper {
    Course find(@Param("id") int id);

    List<Course> findAll();

    List<Course> findPage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    List<Course> findPageByName(
            @Param("courseName") String courseName,
            @Param("pageNum") int pageNum,
            @Param("pageSize") int pageSize
    );

    int count();

    int pageCount(@Param("pageSize") int pageSize);

    int pageCountByName(@Param("courseName") String courseName, @Param("pageSize") int pageSize);

    int insert(@Param("course") Course course);

    int insertBatch(@Param("courses") List<Course> courses);

    int delete(@Param("id") int id);

    int deleteBatch(@Param("courses") List<Course> courses);

    int update(@Param("course") Course Course);

    int updateBatch(@Param("courses") List<Course> courses);

}
